HTTP brochure request

This workflow builds on the knowledge acquired in HTTP PDF Invoice Request and uses a single process, but in this case it also uses a PlanetPress Design document (see PlanetPress Design documents) which merges the data received from a browser form with the document to generate a PDF brochure, which is sent via email.

Resources

Installation

  • Download both files and unzip them.
  • Open InformationBrochure.pp7 and send it to PlanetPress Workflow.
  • Open HTTPBrochureRequest.pw7 and send the configuration to your local PlanetPress Workflow service.
  • Open your browser to http://localhost:8080/generatebrochure

Task breakdown

  • The HTTP Server Input receives the initial request from the browser.
  • Because this is a demonstration, a backup is made of the XML request. It's not suggested to do this every time, especially on servers receiving a large number of requests, as these files do take some amount of space for each request.
  • A condition checks whether the form has been submitted, by verifying that one of the required fields is empty. If it is, it means this is the initial request, so the condition becomes true.
    • If this is the initial request, an HTML page is created which contains a form asking the client for a required full name and email, and optional company name. A checkmark also offers to subscribe to a newsletter (it is unchecked by default!). The form submits back to the same URL, meaning it is handled by the same process.
    • The file is renamed with the .html extension, so that both the HTTP service and the browser will recognize it as an HTML page. And then, as usual, it is deleted (but still returned to the browser).
  • When the condition is false, it means that there is something in the Full Name field. In this case, we know that the form was filled and submitted back to the process, and we handle the request as such.
  • First, we add the full name, email and company information to job informations, in order for them to be available for the rest of the process.
  • Then, we have a small condition that verifies if the user checked the "Newsletter" box. If so, the conditional branch is triggered. Note that this condition is put inside its own branch because otherwise, the rest of the process would not run when the newsletter is selected. Since we want both to happen, the branch is there with a "stub" if the condition is false.